import time

from Page.Page1 import Page
from selenium.webdriver.common.by import By

class Page2(Page):
    # 定位
    # 点击我的酒仙网/html/body/div[2]/div/div[2]/ul/li[1]/div[1]/a
    dianjiuxian_loc=(By.XPATH,'/html/body/div[2]/div/div[2]/ul/li[1]/div[1]/a')

    # 点击收货地址/html/body/div[4]/div[1]/div[2]/div[4]/a[3]
    dianshouhuo_loc=(By.XPATH,'/html/body/div[4]/div[1]/div[2]/div[4]/a[3]')
    # 输入姓名
    shouhuo_name_loc=(By.ID,'people')
    # 往下滑800
    # 地区1定位选择北京name="province"
    value_loc=(By.NAME,"province")

    # 地区2定位选择北京市name="city"
    index_loc=(By.NAME,'city')

    # 地区2定位选择北京市name="district"
    text_loc=(By.NAME,'district')

    # 详细地址# id = "address"
    xaingxi_loc=(By.ID,'address')
    # id = "zipcode"邮政编码
    youzheng_loc=(By.ID,"zipcode")
    # 手机号id="iphone"
    shouji_loc=(By.ID,'iphone')
    # 提交class="qjwSubmit2"
    tijiao_loc=(By.CLASS_NAME,'qjwSubmit2')
    # 点击确定/html/body/div[8]/div/div[3]/span[1]
    queding_loc=(By.XPATH,'/html/body/div[8]/div/div[3]/span[1]')
    # 封装
    # 点击我的酒仙网
    def dianjixian(self):
        self.click(self.dianjiuxian_loc)
    # 切换页面
    def qiehuan(self):
        self.new_window()

    def xiahua(self):
        self.scrool_x(800)
    def dianshouhuo(self):
        self.click(self.dianshouhuo_loc)
    def shouhuo_name(self):
        self.send_keys(self.shouhuo_name_loc,"陈景城")
    def value(self):
        self.select_loc_value(self.value_loc,"2")
    def index(self):
        self.select_loc_index(self.index_loc,1)
    def text(self):
        self.select_loc_text(self.text_loc,"昌平区")
    def xaingxi(self):
        self.send_keys(self.xaingxi_loc,"北京 北京市 昌平区")
    def youzheng(self):
        self.send_keys(self.youzheng_loc,"102200")
    def shouji(self):
        self.send_keys(self.shouji_loc,"13485456209")
    def tijiao(self):
        self.click(self.tijiao_loc)
    def queding(self):
        self.click(self.queding_loc)





    def test_jiegous(self):
        self.test_luoji()
        self.dianjixian()

        self.qiehuan()
        time.sleep(20)

        self.xiahua()
        self.dianshouhuo()
        self.shouhuo_name()
        time.sleep(2)
        self.value()
        self.index()
        self.text()
        self.xaingxi()
        time.sleep(2)
        self.youzheng()
        time.sleep(2)
        self.shouji()
        self.tijiao()
        time.sleep(2)
        self.queding()




